
** Open Dataset
 use "Analysis Dataset.dta", clear
 

*****************	
** Create Vars **
*****************	
	** Main DV = Number of Issues Mentioned (set to 0 if no response). [Per contact with constituent - how many issue requests do you expect?]
	gen all_num_issues = NumberIssues
		replace all_num=0 if NumberIssues==.	
	
	** DV=Approval Rating of Party
	gen positive_approval= abs(6-approve_party)
	
	** Voter's partisanship
	gen sameparty=1 if residence_addresses_state=="State 1" & parties_description=="Democratic" |residence_addresses_state=="State 2" & parties_description=="Republican"
		replace sameparty=0 if sameparty==.
	gen otherparty=1 if residence_addresses_state=="State 1" & parties_description=="Republican" |residence_addresses_state=="State 2" & parties_description=="Democratic" 
		replace otherparty=0 if otherparty==.

	** Voter's gender
	gen Fem_voter=voters_gender=="F"
		replace Fem_voter=. if voters_gender==""
	
	** Age
	destring voters_age, replace force
 
	** Donor
	gen donor=fecdonors_numberofdonations!="NA"
 
	** Election Participation
	gen num_primaries=p14+p16+p18 
	gen num_generals=g14+g16+g18

	** Engagement with Survey
	gen started_survey=Finished!=.
	gen askedsomething=NumberIssues!=.
	

******************	
** Analyze Data **
******************
	
** Create Observations to Get Predicted values for Table D2 (Highlights the difference by levels of participation)
	set obs 30594
	replace fem_treatment=0 if _n>=30591
	replace Fem_voter=0 if _n>=30591
	replace voters_age=40 if _n>=30591
	replace sameparty=0 if _n>=30591
	replace otherparty=0 if _n>=30591
	replace residence_addresses_state="State 1" if _n>=30591
	
	replace num_generals=0 if _n>=30591
	replace num_primaries=0 if _n>=30591
	replace donor=0 if _n>=30591

	replace num_generals=3 if _n>=30592
	replace num_primaries=3 if _n>=30593
	replace donor=1 if _n>=30594

*********************
** Main regression **
*********************

** Table 1. Main Result
	xi: reg all_num_issues fem_treatment 
	xi: reg all_num_issues fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty i.residence_addresses_state

************************
** Appendices Results **
************************		
		
** Table D2. Predicted Results by Level of Political Activity
	predict predicted_dv
	browse num_generals num_prim donor predicted_dv if _n>=30591
	
** Table C1. Valence in Comments
	reg NegValence fem_treatment 
	xi: reg NegValence fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty i.residence_addresses_state
	reg PoValence fem_treatment 
	xi: reg PoValence fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty i.residence_addresses_state
		
** Tablc C2. Approval Rating
	xi: oprobit positive_approval fem_treatment 
	xi: oprobit positive_approval fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty i.residence_addresses_state
	
** Table D1.  Main Results by Party
	xi: reg all_num_issues fem_treatment if residence_addresses_state=="State 1"
	xi: reg all_num_issues fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty if residence_addresses_state=="State 1"
	xi: reg all_num_issues fem_treatment if residence_addresses_state=="State 2"
	xi: reg all_num_issues fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty if residence_addresses_state=="State 2"

** Table D4
	** More likley to respond?
		xi: reg started_survey fem_treatment 		
		xi: reg started_survey fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty i.residence_addresses_state		
	** Ask more in survey?
		replace NumberIssues=0 if NumberIssues==. & started_survey==1	
		xi: reg NumberIssues  fem_treatment 
		xi: reg NumberIssues  fem_treatment Fem_voter i.num_generals i.num_primaries donor voters_age  sameparty otherparty i.residence_addresses_state

***********************************************
** Regression for mention by person of issue **
** No survey response = 0 					 **
***********************************************

forvalues i=1(1)1{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}
		
forvalues i=2(1)5{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}	
			
forvalues i=6(1)6{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}
		
forvalues i=7(1)10{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}	
			
forvalues i=12(1)12{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}	
		
forvalues i=13(1)14{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}
		
forvalues i=20(1)20{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}	
		
forvalues i=24(1)24{
	gen issueDV_mention`i'=1 if issue1>=`i'00 & issue1<=`i'99 | issue2>=`i'00 & issue2<=`i'99 | issue3>=`i'00 & issue3<=`i'99 | issue4>=`i'00 & issue4<=`i'99 | issue5>=`i'00 & issue5<=`i'99 | issue6>=`i'00 & issue6<=`i'99 | issue7>=`i'00 & issue7<=`i'99 | issue8>=`i'00 & issue8<=`i'99 | issue9>=`i'00 & issue9<=`i'99 | issue10>=`i'00 & issue10<=`i'99 | issue11>=`i'00 & issue11<=`i'99 | issue12>=`i'00 & issue12<=`i'99 | issue13>=`i'00 & issue13<=`i'99 | issue14>=`i'00 & issue14<=`i'99 | issue15>=`i'00 & issue15<=`i'99 | issue16>=`i'00 & issue16<=`i'99 | issue17>=`i'00 & issue17<=`i'99 | issue18>=`i'00 & issue18<=`i'99 | issue19>=`i'00 & issue19<=`i'99 | issue20>=`i'00 & issue20<=`i'99 | issue21>=`i'00 & issue21<=`i'99 | issue22>=`i'00 & issue22<=`i'99 
		replace issueDV_mention`i'=0 if issueDV_mention`i'==.
		reg issueDV_mention`i' fem_treatment
		}	
